package com.cnnp.dip.api.config;

import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;

import feign.RequestInterceptor;

@Component
public class GrafanaRequestInterceptor implements RequestInterceptor {

    private final GrafanaConfig grafanaConfig;

    public GrafanaRequestInterceptor(GrafanaConfig grafanaConfig) {
        this.grafanaConfig = grafanaConfig;
    }

    @Override
    public void apply(feign.RequestTemplate requestTemplate) {
        requestTemplate.header(HttpHeaders.AUTHORIZATION, "Bearer " + grafanaConfig.getApiKey());
    }
} 